package com.vaadin.incubator.bugrap.tests.model;

import org.junit.Test;

import com.vaadin.incubator.bugrap.model.facade.FacadeUtil;
import com.vaadin.incubator.bugrap.model.users.Reporter;

/**
 * @author John Ahlroos / Vaadin Oy
 * 
 */
public class ReporterTest extends TestBase {

	/**
	 * Test method for
	 * {@link com.vaadin.incubator.bugrap.model.users.Reporter#getName()}.
	 */
	@Test
	public void testGetName() {
		Reporter reporter = new Reporter();
		reporter.setName("Test User");
		reporter = FacadeUtil.store(reporter);
		String name = reporter.getName();
		assertEquals("Test User", name);
	}

	/**
	 * Test method for
	 * {@link com.vaadin.incubator.bugrap.model.users.Reporter#setName(java.lang.String)}
	 * .
	 */
	@Test
	public void testSetName() {
		Reporter reporter = new Reporter();
		reporter.setName("Test User");
		reporter = FacadeUtil.store(reporter);
		String name = reporter.getName();
		assertEquals("Test User", name);
	}

	/**
	 * Test method for
	 * {@link com.vaadin.incubator.bugrap.model.users.Reporter#getEmail()}.
	 */
	@Test
	public void testGetEmail() {
		Reporter reporter = new Reporter();
		reporter.setEmail("test@test.com");
		reporter = FacadeUtil.store(reporter);
		String email = reporter.getEmail();
		assertEquals("test@test.com", email);
	}

	/**
	 * Test method for
	 * {@link com.vaadin.incubator.bugrap.model.users.Reporter#setEmail(java.lang.String)}
	 * .
	 */
	@Test
	public void testSetEmail() {
		Reporter reporter = new Reporter();
		reporter.setEmail("test@test.com");
		reporter = FacadeUtil.store(reporter);
		String email = reporter.getEmail();
		assertEquals("test@test.com", email);
	}

	/**
	 * Test method for
	 * {@link com.vaadin.incubator.bugrap.model.users.Reporter#getPassword()}.
	 */
	@Test
	public void testGetPassword() {
		Reporter reporter = new Reporter();
		reporter.setPassword("abcdefgh");
		reporter = FacadeUtil.store(reporter);
		String password = reporter.getPassword();
		assertEquals("abcdefgh", password);
	}

	/**
	 * Test method for
	 * {@link com.vaadin.incubator.bugrap.model.users.Reporter#setPassword(java.lang.String)}
	 * .
	 */
	@Test
	public void testSetPassword() {
		Reporter reporter = new Reporter();
		reporter.setPassword("abcdefgh");
		reporter = FacadeUtil.store(reporter);
		String password = reporter.getPassword();
		assertEquals("abcdefgh", password);
	}

	/**
	 * Test method for
	 * {@link com.vaadin.incubator.bugrap.model.users.Reporter#isAdmin()}.
	 */
	@Test
	public void testIsAdmin() {
		Reporter reporter = new Reporter();
		reporter.setAdmin(true);
		reporter = FacadeUtil.store(reporter);
		assertTrue(reporter.isAdmin());

		reporter.setAdmin(false);
		reporter = FacadeUtil.store(reporter);
		assertFalse(reporter.isAdmin());
	}

	/**
	 * Test method for
	 * {@link com.vaadin.incubator.bugrap.model.users.Reporter#setAdmin(boolean)}
	 * .
	 */
	@Test
	public void testSetAdmin() {
		Reporter reporter = new Reporter();
		reporter.setAdmin(true);
		reporter = FacadeUtil.store(reporter);
		assertTrue(reporter.isAdmin());

		reporter.setAdmin(false);
		reporter = FacadeUtil.store(reporter);
		assertFalse(reporter.isAdmin());
	}
}
